package com.xiaoyu.client.adapter.discovery;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.xiaoyu.client.R;
import com.xiaoyu.client.model.discovery.NoticeThankBean.DataBean.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 感谢榜单item适配器
 * Created by jk on 2018/10/17.
 */
public class ThankRecyAdapter extends RecyclerView.Adapter<ThankRecyAdapter.ViewHolder>{
    private Context mContext;
    private List<ThankBean> mList = new ArrayList<>();

    public ThankRecyAdapter(Context mContext, List<ThankBean> mList) {
        this.mContext = mContext;
        this.mList = mList;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_thank,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        holder.nameThankedTxt.setText(mList.get(position).getThinknickname());
        holder.nameTxt.setText("--"+mList.get(position).getNickname());
        holder.contentTxt.setText(mList.get(position).getThanktitle());
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder {
        private TextView nameThankedTxt;//被感谢者
        private TextView contentTxt;//感谢内容
        private TextView nameTxt;//感谢者
        public ViewHolder(View itemView) {
            super(itemView);
            nameThankedTxt = itemView.findViewById(R.id.item_thank_name_of_thanked_txt);
            contentTxt = itemView.findViewById(R.id.item_thank_content_txt);
            nameTxt = itemView.findViewById(R.id.item_thank_name_of_publish);
        }
    }

}
